home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / IELLIPSE.C < prev    next >
C/C++ Source or Header  |  1980-01-05  |  4KB  |  107 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: iellipses.c,v 1.7 89/10/09 14:48:11 linton Exp $
  24. // implements classes IFillEllipse and IFillCircle.
  25.  
  26. #include "iellipses.h"
  27. #include "ipaint.h"
  28.  
  29. // IFillEllipse passes its arguments to FillEllipse.
  30.  
  31. IFillEllipse::IFillEllipse (Coord x0, Coord y0, int rx, int ry, Graphic* gs)
  32. : (x0, y0, rx, ry, gs) {
  33. }
  34.  
  35. // contains returns true if the IFillEllipse contains the given point
  36. // unless the pattern is the "none" pattern.
  37.  
  38. boolean IFillEllipse::contains (PointObj& po, Graphic* gs) {
  39.     boolean contains = false;
  40.     IPattern* pattern = (IPattern*) gs->GetPattern();
  41.     if (!pattern->None()) {
  42.     contains = FillEllipse::contains(po, gs);
  43.     }
  44.     return contains;
  45. }
  46.  
  47. // intersects returns true if the IFillEllipse intersects the given
  48. // box unless the pattern is the "none" pattern.
  49.  
  50. boolean IFillEllipse::intersects (BoxObj& userb, Graphic* gs) {
  51.     boolean intersects = false;
  52.     IPattern* pattern = (IPattern*) gs->GetPattern();
  53.     if (!pattern->None()) {
  54.     intersects = FillEllipse::intersects(userb, gs);
  55.     }
  56.     return intersects;
  57. }
  58.  
  59. // draw draws the IFillEllipse unless the pattern is the "none" pattern.
  60.  
  61. void IFillEllipse::draw (Canvas* c, Graphic* gs) {
  62.     IPattern* pattern = (IPattern*) gs->GetPattern();
  63.     if (!pattern->None()) {
  64.     FillEllipse::draw(c, gs);
  65.     }
  66. }
  67.  
  68. // IFillCircle passes its arguments to FillCircle.
  69.  
  70. IFillCircle::IFillCircle (Coord x0, Coord y0, int r, Graphic* gs)
  71. : (x0, y0, r, gs) {
  72. }
  73.  
  74. // contains returns true if the IFillCircle contains the given point
  75. // unless the pattern is the "none" pattern.
  76.  
  77. boolean IFillCircle::contains (PointObj& po, Graphic* gs) {
  78.     boolean contains = false;
  79.     IPattern* pattern = (IPattern*) gs->GetPattern();
  80.     if (!pattern->None()) {
  81.     contains = FillCircle::contains(po, gs);
  82.     }
  83.     return contains;
  84. }
  85.  
  86. // intersects returns true if the IFillCircle intersects the given box
  87. // unless the pattern is the "none" pattern.
  88.  
  89. boolean IFillCircle::intersects (BoxObj& userb, Graphic* gs) {
  90.     boolean intersects = false;
  91.     IPattern* pattern = (IPattern*) gs->GetPattern();
  92.     if (!pattern->None()) {
  93.     intersects = FillCircle::intersects(userb, gs);
  94.     }
  95.     return intersects;
  96. }
  97.  
  98. // draw draws the IFillCircle unless the pattern is the "none"
  99. // pattern.
  100.  
  101. void IFillCircle::draw (Canvas* c, Graphic* gs) {
  102.     IPattern* pattern = (IPattern*) gs->GetPattern();
  103.     if (!pattern->None()) {
  104.     FillCircle::draw(c, gs);
  105.     }
  106. }
  107.